package com.itheima.text6;

import java.util.concurrent.CountDownLatch;

//并发工具类-Semaphore
public class Demo1 {
    public static void main(String[] args) {
        //创建CountDownLatch的对象,传递四个线程
        //在底层定义了一个计数器, 之此时值为3
        CountDownLatch cd = new CountDownLatch(3);
        //创建4个线程 并开启
        Chile c = new Chile(cd);
        c.setName("小张");

        Chile2 c2 = new Chile2(cd);
        c2.setName("小刘");

        Chile3 c3 = new Chile3(cd);
        c3.setName("小马");

        Mom m = new Mom(cd);

        c.start();
        c2.start();
        c3.start();
        m.start();


    }
}
